local isMouseLeftButtonBlocked = false

-- 检查本地KVP并加载状态
Citizen.CreateThread(function()
        Citizen.Wait(500)
        if GetResourceKvpInt("mouseLeftButtonBlocked") == 1 then
            isMouseLeftButtonBlocked = true
        end

end)

-- 注册命令来切换鼠标左键屏蔽状态
RegisterCommand("togglefight", function()
    isMouseLeftButtonBlocked = not isMouseLeftButtonBlocked  -- 切换状态
    if isMouseLeftButtonBlocked then
        SetResourceKvpInt("mouseLeftButtonBlocked", 1)  -- 保存状态
        TriggerEvent('chat:addMessage',  {args = {"[系统]攻击关闭"}, color = {255,0,0}})
    else
        DeleteResourceKvp("mouseLeftButtonBlocked")  -- 清除状态
        TriggerEvent('chat:addMessage',  {args = {"[系统]攻击开启"}, color = {255,0,0}})
    end
end)
Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if isMouseLeftButtonBlocked then
            DisableControlAction(0, 24, true)  -- 屏蔽鼠标左键
            DisableControlAction(0, 140, true)
            DisablePlayerFiring(PlayerId(), true)
        end
    end
end)